package com.sanyang.pda.ui.takestock;

import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import com.alibaba.android.arouter.facade.annotation.Route;
import com.sanyang.pda.adapter.StockStatisticsDetailAdapter;
import com.sanyang.pda.contract.StockStatisticsDetailContract;
import com.sanyang.pda.presenter.StockStatisticsDetailPresenter;
import com.sanyang.pda.utils.StringConfig;
import com.wangshen.base.app.AppActivityKey;
import com.wangshen.base.ui.mvp.base.adapter.BaseAdapter;
import com.wangshen.base.ui.mvp.base.refresh.BaseRecyclerRefreshActivity;
import com.wangshen.projectbase.R;

import java.util.ArrayList;

@Route(path = AppActivityKey.STOCKSTATISTICSDETAILACTIVITY)
public class StockStatisticsDetailActivity extends BaseRecyclerRefreshActivity<StockStatisticsDetailPresenter> implements StockStatisticsDetailContract.View {
    String storagebinId,taskNo;
    @Override
    public StockStatisticsDetailPresenter getPresenter() {
        return new StockStatisticsDetailPresenter();
    }


    @Override
    public void initView() {
        getRefreshLayout().setEnableLoadMore(false);
        View view= LayoutInflater.from(mContext).inflate(R.layout.layout_title,llRoot,false);
        llRoot.addView(view,0);
        TextView textView=view.findViewById(R.id.tv_title);
        textView.setText(getString(R.string.statistics_detail));
        ImageView back=view.findViewById(R.id.iv_back);
        back.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                finishActivity();
            }
        });
    }

    @Override
    public void initLinsenterner() {

    }

    @Override
    public void getData() {
        Bundle bundle=getIntent().getExtras();
        storagebinId=bundle.getString(StringConfig.STORAGEBINID);
        taskNo=bundle.getString(StringConfig.TASKNO);
        presenter.setTaskNo(taskNo);
        presenter.setStoragebinId(storagebinId);
        getRefreshLayout().autoRefresh();
    }

    @Override
    public BaseAdapter createRecyclerAdapter() {
        return new StockStatisticsDetailAdapter(R.layout.item_stock_abnormal, new ArrayList<>());
    }
}
